From 1d8830341ce22d8357cd592fcb30b50c929fa722 Mon Sep 17 00:00:00 2001 From: Mike Boutin Date: Mon, 3 Aug 2015 21:11:34 -0400 Subject: [PATCH] Add `no_term` test that ensures correct output when a `TerminfoTerminal` cannot be created. --- tests/test_shell.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_shell.rs b/tests/test_shell.rs index d3ee5f591..a91e18c53 100644 --- a/tests/test_shell.rs +++ b/tests/test_shell.rs @@ -28,7 +28,18 @@ test!(non_tty { Shell::create(Box::new(Sink(a.clone())), config).tap(|shell| { shell.say("Hey Alex", color::RED).unwrap(); }); + let buf = a.lock().unwrap().clone(); + assert_that(&buf[..], shell_writes("Hey Alex\n")); +}); +test!(no_term { + let config = ShellConfig { color_config: Always, tty: false }; + let a = Arc::new(Mutex::new(Vec::new())); + + ::std::env::remove_var("TERM"); + Shell::create(Box::new(Sink(a.clone())), config).tap(|shell| { + shell.say("Hey Alex", color::RED).unwrap(); + }); let buf = a.lock().unwrap().clone(); assert_that(&buf[..], shell_writes("Hey Alex\n")); }); -- 2.30.2